﻿$(function() {
    var datasets = [
         {
             label: "Upper Limit",
             data: [
[30, 31.861],
[32, 32.400],
[34, 32.915],
[36, 33.408],
[38, 33.881],
[40, 34.336],
[42, 34.774],
[44, 35.197],
[46, 35.606],
[48, 36.002],
[50, 36.387],
[52, 36.759],
[54, 37.122],
[56, 37.475],
[58, 37.818],
[60, 38.153],
[62, 38.480],
[64, 38.799],
[66, 39.110],
[68, 39.415],
[70, 39.713],
[72, 40.005],
[74, 40.291],
[76, 40.571],
[78, 40.846],
[80, 41.116],
[82, 41.381],
[84, 41.641],
[86, 41.897],
[88, 42.148],
[90, 42.395],
[92, 42.638],
[94, 42.877],
[96, 43.112],
[98, 43.344],
[100, 43.572],
[102, 43.797],
[104, 44.019],
[106, 44.237],
[108, 44.453],
[110, 44.665],
[112, 44.875],
[114, 45.082],
[116, 45.286],
[118, 45.488],
[120, 45.687],
[122, 45.884],
[124, 46.079],
[126, 46.271],
[128, 46.460],
[130, 46.648],
[132, 46.834],
[134, 47.017],
[136, 47.199],
[138, 47.378],
[140, 47.556],
[142, 47.731],
[144, 47.905],
[146, 48.077],
[148, 48.248],
[150, 48.416]
]
         },
        {
            label: "Mean",
            data: [
[30, 25.569],
[32, 26.002],
[34, 26.415],
[36, 26.810],
[38, 27.190],
[40, 27.555],
[42, 27.907],
[44, 28.246],
[46, 28.575],
[48, 28.893],
[50, 29.201],
[52, 29.500],
[54, 29.791],
[56, 30.074],
[58, 30.350],
[60, 30.618],
[62, 30.881],
[64, 31.137],
[66, 31.387],
[68, 31.631],
[70, 31.871],
[72, 32.105],
[74, 32.334],
[76, 32.559],
[78, 32.780],
[80, 32.996],
[82, 33.209],
[84, 33.418],
[86, 33.623],
[88, 33.824],
[90, 34.023],
[92, 34.218],
[94, 34.409],
[96, 34.598],
[98, 34.784],
[100, 34.967],
[102, 35.148],
[104, 35.326],
[106, 35.501],
[108, 35.674],
[110, 35.845],
[112, 36.013],
[114, 36.179],
[116, 36.343],
[118, 36.505],
[120, 36.665],
[122, 36.823],
[124, 36.979],
[126, 37.133],
[128, 37.285],
[130, 37.436],
[132, 37.585],
[134, 37.732],
[136, 37.878],
[138, 38.022],
[140, 38.164],
[142, 38.305],
[144, 38.445],
[146, 38.583],
[148, 38.720],
[150, 38.855]
]
        },
        {
            label: "Lower Limit",
            data: [
[30, 20.520],
[32, 20.867],
[34, 21.198],
[36, 21.516],
[38, 21.820],
[40, 22.113],
[42, 22.396],
[44, 22.668],
[46, 22.932],
[48, 23.187],
[50, 23.434],
[52, 23.674],
[54, 23.908],
[56, 24.135],
[58, 24.356],
[60, 24.572],
[62, 24.782],
[64, 24.988],
[66, 25.188],
[68, 25.385],
[70, 25.577],
[72, 25.765],
[74, 25.949],
[76, 26.129],
[78, 26.307],
[80, 26.480],
[82, 26.651],
[84, 26.818],
[86, 26.983],
[88, 27.145],
[90, 27.304],
[92, 27.460],
[94, 27.614],
[96, 27.766],
[98, 27.915],
[100, 28.062],
[102, 28.207],
[104, 28.350],
[106, 28.490],
[108, 28.629],
[110, 28.766],
[112, 28.901],
[114, 29.035],
[116, 29.166],
[118, 29.296],
[120, 29.424],
[122, 29.551],
[124, 29.676],
[126, 29.800],
[128, 29.922],
[130, 30.043],
[132, 30.163],
[134, 30.281],
[136, 30.398],
[138, 30.513],
[140, 30.628],
[142, 30.741],
[144, 30.853],
[146, 30.964],
[148, 31.073],
[150, 31.182]
]
        }
    ]; //end datasets


    function plotAccordingToChoices() {
        var data = datasets;
        if (data.length > 0)
            $.plot($("#placeholder"), data, {
                yaxis: {
                    min: 10,
                    max: 60
                },
                xaxis: {
                    tickDecimals: 0
                },
                crosshair: { mode: 'xy' },
                grid: { hoverable: true }
            });
    }
    function plotAccordingToChoices2() {
        var data = datasets;
        if (data.length > 0)
            $.plot($("#placeholder"), data, {
                yaxis: {
                    min: 10,
                    max: 60,
                    transform: function(v) { return Math.log(v); },
                    inverseTransform: function(v) { return Math.exp(v); }
                },
                xaxis: {
                    tickDecimals: 0,
                    transform: function(v) { return Math.log(v); },
                    inverseTransform: function(v) { return Math.exp(v); }
                },
                crosshair: { mode: 'xy' },
                grid: { hoverable: true }
            });
    }
    plotAccordingToChoices2();

    $('#Radio1').click(plotAccordingToChoices);
    $('#Radio2').click(plotAccordingToChoices2);

    var previousPoint = null; 
    $("#placeholder").bind("plothover", function (event, pos, item) { 
    $("#x").text(pos.x.toFixed(2)); 
    $("#y").text(pos.y.toFixed(2)); 
    });
    
});
